package com.kiss.fw.notifications;

import com.kiss.fw.context.EmailContext;
import com.kiss.fw.context.NotificationContext;
import com.kiss.fw.utils.Util;

public class EmailNotification extends AbstractNotification {
	private static final AbstractNotification instance = new EmailNotification();
	
	private EmailNotification() {
	}
	
	public static AbstractNotification getInstance() {
		return instance;
	}
	
	/**
	 * Sends email notification.
	 * 
	 * The <code>NotificationContext</code> that is passed needs to contain an entry
	 * with an <code>EmailContext</code>.  An instance to a <code>EmailContext</code>
	 * could be retrieved by calling the 
	 * 
	 * @param NotificationContext _context
	 * @return boolean
	 */
	@Override
	public boolean send(NotificationContext _context) {
		EmailContext emailContext = (EmailContext)_context.getAttribute(NotificationContext.EMAIL_CONTEXT);
		
		return Util.sendEmail(emailContext);
	}
}